/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * mainMenu.java
 *
 * Created on Oct 31, 2009, 5:23:32 PM
 */

package example;

import javax.swing.ImageIcon;

/**
 *
 * @author keysman
 */
public class mainMenu extends javax.swing.JDialog {
    private int _HEIGHT = 300;
    private int _WIDTH  = 620;

    /** Creates new form mainMenu */
    public mainMenu(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        setBounds( our.gui.utils.centerOnVideo(_WIDTH, _HEIGHT) );
        if(System.getProperty("os.name").toLowerCase().indexOf("mac")<0)
        {
            ImageIcon img = new ImageIcon(ClassLoader.getSystemResource("example/mainicon.png"));
            setIconImage(img.getImage());
        }
        // Connect to database stored in user home folder
        String strDBPath = "jdbc:h2:" + System.getProperty("user.home") 
                           + System.getProperty("file.separator") + "exampledb"
                           + System.getProperty("file.separator") + "exampledb";
        String strLogPath = System.getProperty("user.home")
                           + System.getProperty("file.separator") + "exampledb.log";
        // Connessione al database (questa è necessario per il framework)
        // Un utente può crearsene una sua principale se vuole usare framework
        // alternativi per l'O/R tipo Cayenne, iBatis o Hibernate
        //our.gui.utils.DBConnection("org.h2.Driver", strDBPath, "sa", "", strLogPath);
        our.gui.utils.Initialize("/example/config.xml");
        // Abilito i tutti i permessi all'utente (essendo una demo single-user)
        our.gui.utils.USER_ALLOW_EDIT = true;
        our.gui.utils.USER_ALLOW_INS  = true;
        our.gui.utils.USER_ALLOW_DEL  = true;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        mnuMain = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenu2 = new javax.swing.JMenu();
        jMenuItem23 = new javax.swing.JMenuItem();
        jSeparator5 = new javax.swing.JPopupMenu.Separator();
        jMenuItem24 = new javax.swing.JMenuItem();
        jMenuItem25 = new javax.swing.JMenuItem();
        jMenuItem26 = new javax.swing.JMenuItem();
        jSeparator6 = new javax.swing.JPopupMenu.Separator();
        jMenuItem27 = new javax.swing.JMenuItem();
        jMenu3 = new javax.swing.JMenu();
        jMenu4 = new javax.swing.JMenu();
        jMenu5 = new javax.swing.JMenu();
        jMenu6 = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JSeparator();
        jMenuItem2 = new javax.swing.JMenuItem();
        jMenuItem3 = new javax.swing.JMenuItem();
        jMenuItem4 = new javax.swing.JMenuItem();
        jMenuItem5 = new javax.swing.JMenuItem();
        jSeparator2 = new javax.swing.JSeparator();
        jMenuItem6 = new javax.swing.JMenuItem();
        jMenuItem7 = new javax.swing.JMenuItem();
        jSeparator3 = new javax.swing.JSeparator();
        jMenuItem8 = new javax.swing.JMenuItem();
        jMenuItem9 = new javax.swing.JMenuItem();
        jSeparator4 = new javax.swing.JSeparator();
        jMenuItem10 = new javax.swing.JMenuItem();
        jMenuItem11 = new javax.swing.JMenuItem();
        jMenuItem12 = new javax.swing.JMenuItem();
        jMenuItem13 = new javax.swing.JMenuItem();
        jMenuItem14 = new javax.swing.JMenuItem();
        jMenuItem15 = new javax.swing.JMenuItem();
        jMenuItem16 = new javax.swing.JMenuItem();
        jMenuItem17 = new javax.swing.JMenuItem();
        jMenuItem18 = new javax.swing.JMenuItem();
        jMenuItem19 = new javax.swing.JMenuItem();
        jMenuItem20 = new javax.swing.JMenuItem();
        jMenu7 = new javax.swing.JMenu();
        jMenu8 = new javax.swing.JMenu();
        jMenuItem21 = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Hotel Manager");
        setIconImage(null);
        setIconImages(null);
        setResizable(false);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
        });
        getContentPane().setLayout(null);

        jMenu1.setMnemonic('G');
        jMenu1.setText("Gestione");
        mnuMain.add(jMenu1);

        jMenu2.setMnemonic('A');
        jMenu2.setText("Anagrafiche");

        jMenuItem23.setText("Anagrafica Albergo");
        jMenu2.add(jMenuItem23);
        jMenu2.add(jSeparator5);

        jMenuItem24.setText("Clienti");
        jMenu2.add(jMenuItem24);

        jMenuItem25.setText("Ditte");
        jMenu2.add(jMenuItem25);

        jMenuItem26.setText("Agenzie");
        jMenu2.add(jMenuItem26);
        jMenu2.add(jSeparator6);

        jMenuItem27.setText("Fornitori");
        jMenu2.add(jMenuItem27);

        mnuMain.add(jMenu2);

        jMenu3.setMnemonic('M');
        jMenu3.setText("Magazzino");
        mnuMain.add(jMenu3);

        jMenu4.setMnemonic('V');
        jMenu4.setText("Varie");
        mnuMain.add(jMenu4);

        jMenu5.setMnemonic('D');
        jMenu5.setText("Documenti");
        mnuMain.add(jMenu5);

        jMenu6.setMnemonic('T');
        jMenu6.setText("Tabelle");
        jMenu6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenu6ActionPerformed(evt);
            }
        });

        jMenuItem1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/example/archive-icon.png"))); // NOI18N
        jMenuItem1.setMnemonic('P');
        jMenuItem1.setText("Piani");
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu6.add(jMenuItem1);
        jMenu6.add(jSeparator1);

        jMenuItem2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/example/archive-icon.png"))); // NOI18N
        jMenuItem2.setMnemonic('T');
        jMenuItem2.setText("Tipologia Camere");
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
            }
        });
        jMenu6.add(jMenuItem2);

        jMenuItem3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/example/archive-icon.png"))); // NOI18N
        jMenuItem3.setMnemonic('C');
        jMenuItem3.setText("Camere");
        jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem3ActionPerformed(evt);
            }
        });
        jMenu6.add(jMenuItem3);

        jMenuItem4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/example/archive-icon.png"))); // NOI18N
        jMenuItem4.setMnemonic('O');
        jMenuItem4.setText("Optionals");
        jMenu6.add(jMenuItem4);

        jMenuItem5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/example/archive-icon.png"))); // NOI18N
        jMenuItem5.setMnemonic('r');
        jMenuItem5.setText("Trattamenti");
        jMenu6.add(jMenuItem5);
        jMenu6.add(jSeparator2);

        jMenuItem6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/example/archive-icon.png"))); // NOI18N
        jMenuItem6.setMnemonic('S');
        jMenuItem6.setText("Prezzi Stagionali");
        jMenu6.add(jMenuItem6);

        jMenuItem7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/example/archive-icon.png"))); // NOI18N
        jMenuItem7.setMnemonic('z');
        jMenuItem7.setText("Pietanze");
        jMenu6.add(jMenuItem7);
        jMenu6.add(jSeparator3);

        jMenuItem8.setMnemonic('I');
        jMenuItem8.setText("Città Italiane");
        jMenu6.add(jMenuItem8);

        jMenuItem9.setText("Città Straniere");
        jMenu6.add(jMenuItem9);
        jMenu6.add(jSeparator4);

        jMenuItem10.setText("Aliquota IVA");
        jMenu6.add(jMenuItem10);

        jMenuItem11.setText("Corrieri");
        jMenu6.add(jMenuItem11);

        jMenuItem12.setText("Trasporto a mezzo");
        jMenu6.add(jMenuItem12);

        jMenuItem13.setText("Aspetto dei beni");
        jMenu6.add(jMenuItem13);

        jMenuItem14.setText("Banche");
        jMenu6.add(jMenuItem14);

        jMenuItem15.setText("Conti Correnti");
        jMenu6.add(jMenuItem15);

        jMenuItem16.setText("Pagamenti");
        jMenu6.add(jMenuItem16);

        jMenuItem17.setText("Porto");
        jMenu6.add(jMenuItem17);

        jMenuItem18.setText("Causale Trasporto");
        jMenu6.add(jMenuItem18);

        jMenuItem19.setText("Unità di Misura");
        jMenu6.add(jMenuItem19);

        jMenuItem20.setText("Tabella Documenti");
        jMenu6.add(jMenuItem20);

        mnuMain.add(jMenu6);

        jMenu7.setMnemonic('U');
        jMenu7.setText("Utilità");
        mnuMain.add(jMenu7);

        jMenu8.setMnemonic('i');
        jMenu8.setText("Guida-About");

        jMenuItem21.setText("About...");
        jMenuItem21.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem21ActionPerformed(evt);
            }
        });
        jMenu8.add(jMenuItem21);

        mnuMain.add(jMenu8);

        setJMenuBar(mnuMain);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jMenuItem21ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem21ActionPerformed
        // TODO add your handling code here:
        formAbout formA = new formAbout(null, true);
        formA.setVisible(true);
    }//GEN-LAST:event_jMenuItem21ActionPerformed

    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
        // TODO add your handling code here:
        our.gui.utils.DBClose();
    }//GEN-LAST:event_formWindowClosing

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
        // TODO add your handling code here:
        formPiani frmPiani = null;
        frmPiani = new formPiani(/*"Tabella dei Piani", 20, 20, 192, 500,*/ null, true);
        frmPiani.setVisible(true);
        frmPiani = null;
    }//GEN-LAST:event_jMenuItem1ActionPerformed

    private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
        // TODO add your handling code here:
        formCamere frm = null;
        frm = new formCamere(/*"Tabella Tipologia Camere", 20, 20, 192, 500,*/ null, true);
        frm.setVisible(true);
        frm = null;
    }//GEN-LAST:event_jMenuItem2ActionPerformed

    private void jMenu6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu6ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenu6ActionPerformed

    private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed
        // TODO add your handling code here:
        formDettaglioCamere frm = null;
        frm = new formDettaglioCamere(/*"Tabella delle Camere", 20, 20, 370, 500,*/ null, true);
        frm.setVisible(true);
        frm = null;
    }//GEN-LAST:event_jMenuItem3ActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                mainMenu dialog = new mainMenu(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    @Override
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenu jMenu4;
    private javax.swing.JMenu jMenu5;
    private javax.swing.JMenu jMenu6;
    private javax.swing.JMenu jMenu7;
    private javax.swing.JMenu jMenu8;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem10;
    private javax.swing.JMenuItem jMenuItem11;
    private javax.swing.JMenuItem jMenuItem12;
    private javax.swing.JMenuItem jMenuItem13;
    private javax.swing.JMenuItem jMenuItem14;
    private javax.swing.JMenuItem jMenuItem15;
    private javax.swing.JMenuItem jMenuItem16;
    private javax.swing.JMenuItem jMenuItem17;
    private javax.swing.JMenuItem jMenuItem18;
    private javax.swing.JMenuItem jMenuItem19;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem20;
    private javax.swing.JMenuItem jMenuItem21;
    private javax.swing.JMenuItem jMenuItem23;
    private javax.swing.JMenuItem jMenuItem24;
    private javax.swing.JMenuItem jMenuItem25;
    private javax.swing.JMenuItem jMenuItem26;
    private javax.swing.JMenuItem jMenuItem27;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JMenuItem jMenuItem4;
    private javax.swing.JMenuItem jMenuItem5;
    private javax.swing.JMenuItem jMenuItem6;
    private javax.swing.JMenuItem jMenuItem7;
    private javax.swing.JMenuItem jMenuItem8;
    private javax.swing.JMenuItem jMenuItem9;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JSeparator jSeparator3;
    private javax.swing.JSeparator jSeparator4;
    private javax.swing.JPopupMenu.Separator jSeparator5;
    private javax.swing.JPopupMenu.Separator jSeparator6;
    private javax.swing.JMenuBar mnuMain;
    // End of variables declaration//GEN-END:variables

}
